import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'Home',
      component: () => import('@/views/components/Home.vue')
    },
    {
      path: '/RouterDemo',
      name: 'RouterDemo',
      component: () => import('@/views/RouterDemo.vue')
    },
    {
      path: '/News',
      name: 'News',
      component: () => import('@/views/components/News.vue'),
      children: [
        {
          // path: 'NewsDetail',
          path: 'NewsDetail/:id',
          name: 'NewsDetail',
          component: () => import('@/views/components/NewsDetail.vue'),
          props: true
        }
      ]
    },
    {
      path: '/About',
      name: 'About',
      component: () => import('@/views/components/About.vue')
    },
    {
      path: '/piniaDemo',
      name: 'piniaDemo',
      component: () => import('@/views/piniaDemo.vue')
    },
    {
      path: '/computedDemo',
      name: 'computedDemo',
      component: () => import('@/views/computedDemo.vue')
    },
    {
      path: '/watchEffectDemo',
      name: 'watchEffectDemo',
      component: () => import('@/views/watchEffectDemo.vue')
    },
    {
      path: '/test',
      name: 'test',
      component: () => import('@/views/test.vue')
    }
  ]
})

export default router
